import 'package:flutter/material.dart';

class MyPage extends StatefulWidget {
  const MyPage({super.key});

  @override
  State<MyPage> createState() => _MyPageState();
}

class _MyPageState extends State<MyPage> {
  @override
  Widget build(BuildContext context) {
    return TextButton(onPressed: _gotLogin, child: const Text('登录'));
  }
  _gotLogin() {
   Navigator.of(context).pushNamed("/login");
    // Navigator.of(context).push(new MaterialPageRoute(
    //   builder: (context) {
    //     return new Demo1();
    //   },
    // ));
  }
}
